package com.hdoit.ares.logical.active.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.tennetcn.common.dao.base.impl.SuperService;
import com.hdoit.ares.logical.active.dao.ISignDao;
import com.hdoit.ares.logical.active.model.Sign;
import com.hdoit.ares.logical.active.service.ISignService;
/**
 * @author      wangxuexue
 * @email       
 * @createtime  2017年12月31日 17:56:10
 * @comment
 */
@Component
public class SignServiceImpl extends SuperService<Sign> implements ISignService{

	private ISignDao signDao;
	
	public ISignDao getSignDao() {
		return signDao;
	}
	@Resource
	public void setSignDao(ISignDao signDao) {
		this.signDao = signDao;
	}

	@Override
	public List<String> querySignedDate(String month,String custId) {
		
		return signDao.querySignedDate(month,custId);
	}

	@Override
	public Integer queryAllSignedDays(String month,String custId) {
		
		return signDao.queryAllSignedDays(month,custId);
	}

	@Override
	public Boolean queryIsSignedToday(String month, String day,String custId) {
		
		if(signDao.queryIsSignedToday(month, day,custId)!=null){
			return true;
		}
		return false;
	}

	@Override
	public Integer queryContinuityDays(String month, String day,String custId) {
	
		if(queryIsSignedToday(month,day,custId)){
			return signDao.queryIsSignedToday(month, day,custId).getSignDays();
		}else{
			Integer nextDay =Integer.valueOf(day)-1;
			if(queryIsSignedToday(month,nextDay+"",custId)){
				return signDao.queryIsSignedToday(month, nextDay+"",custId).getSignDays();
			}
		}
		return 0;
	}

}